
<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>pymatgen.io.feff.sets &#8212; pymatgen 2020.7.3 documentation</title>
    <link rel="stylesheet" href="../../../../_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
    <script id="documentation_options" data-url_root="../../../../" src="../../../../_static/documentation_options.js"></script>
    <script src="../../../../_static/jquery.js"></script>
    <script src="../../../../_static/underscore.js"></script>
    <script src="../../../../_static/doctools.js"></script>
    <script src="../../../../_static/language_data.js"></script>
    <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <link rel="index" title="Index" href="../../../../genindex.html" />
    <link rel="search" title="Search" href="../../../../search.html" />
 
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-33990148-1']);
  _gaq.push(['_trackPageview']);
</script>

  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../../index.html">pymatgen 2020.7.3 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../../../pymatgen.html" accesskey="U">pymatgen</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">pymatgen.io.feff.sets</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
          <div class="body" role="main">
            
  <h1>Source code for pymatgen.io.feff.sets</h1><div class="highlight"><pre>
<span></span><span class="c1"># coding: utf-8</span>
<span class="c1"># Copyright (c) Pymatgen Development Team.</span>
<span class="c1"># Distributed under the terms of the MIT License.</span>

<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">This module defines the FeffInputSet abstract base class and a concrete</span>
<span class="sd">implementation for the Materials Project.  The basic concept behind an input</span>
<span class="sd">set is to specify a scheme to generate a consistent set of Feff inputs from a</span>
<span class="sd">structure without further user intervention. This ensures comparability across</span>
<span class="sd">runs.</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">abc</span>
<span class="kn">from</span> <span class="nn">copy</span> <span class="kn">import</span> <span class="n">deepcopy</span>
<span class="kn">import</span> <span class="nn">logging</span>

<span class="kn">from</span> <span class="nn">monty.serialization</span> <span class="kn">import</span> <span class="n">loadfn</span>
<span class="kn">from</span> <span class="nn">monty.json</span> <span class="kn">import</span> <span class="n">MSONable</span>
<span class="kn">from</span> <span class="nn">monty.os.path</span> <span class="kn">import</span> <span class="n">zpath</span>

<span class="kn">from</span> <span class="nn">pymatgen.io.feff.inputs</span> <span class="kn">import</span> <span class="n">Atoms</span><span class="p">,</span> <span class="n">Tags</span><span class="p">,</span> <span class="n">Potential</span><span class="p">,</span> <span class="n">Header</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>

<span class="n">__author__</span> <span class="o">=</span> <span class="s2">&quot;Kiran Mathew&quot;</span>
<span class="n">__credits__</span> <span class="o">=</span> <span class="s2">&quot;Alan Dozier, Anubhav Jain, Shyue Ping Ong&quot;</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s2">&quot;1.1&quot;</span>
<span class="n">__maintainer__</span> <span class="o">=</span> <span class="s2">&quot;Kiran Mathew&quot;</span>
<span class="n">__email__</span> <span class="o">=</span> <span class="s2">&quot;kmathew@lbl.gov&quot;</span>
<span class="n">__date__</span> <span class="o">=</span> <span class="s2">&quot;Sept 10, 2016&quot;</span>

<span class="n">MODULE_DIR</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="vm">__file__</span><span class="p">))</span>

<span class="n">logger</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="vm">__name__</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">setLevel</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">)</span>
<span class="n">formatter</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">Formatter</span><span class="p">(</span><span class="s1">&#39;</span><span class="si">%(asctime)s</span><span class="s1">: </span><span class="si">%(levelname)s</span><span class="s1">: </span><span class="si">%(name)s</span><span class="s1">: </span><span class="si">%(message)s</span><span class="s1">&#39;</span><span class="p">)</span>
<span class="n">sh</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">StreamHandler</span><span class="p">(</span><span class="n">stream</span><span class="o">=</span><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="p">)</span>
<span class="n">sh</span><span class="o">.</span><span class="n">setFormatter</span><span class="p">(</span><span class="n">formatter</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">sh</span><span class="p">)</span>


<div class="viewcode-block" id="AbstractFeffInputSet"><a class="viewcode-back" href="../../../../pymatgen.io.feff.sets.html#pymatgen.io.feff.sets.AbstractFeffInputSet">[docs]</a><span class="k">class</span> <span class="nc">AbstractFeffInputSet</span><span class="p">(</span><span class="n">MSONable</span><span class="p">,</span> <span class="n">metaclass</span><span class="o">=</span><span class="n">abc</span><span class="o">.</span><span class="n">ABCMeta</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Abstract base class representing a set of Feff input parameters.</span>
<span class="sd">    The idea is that using a FeffInputSet, a complete set of input files</span>
<span class="sd">    (feffPOT, feffXANES, feffEXAFS, ATOMS, feff.inp)set_</span>
<span class="sd">    can be generated in an automated fashion for any structure.</span>
<span class="sd">    &quot;&quot;&quot;</span>

<div class="viewcode-block" id="AbstractFeffInputSet.header"><a class="viewcode-back" href="../../../../pymatgen.io.feff.sets.html#pymatgen.io.feff.sets.AbstractFeffInputSet.header">[docs]</a>    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="nf">header</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Returns header to be used in feff.inp file from a pymatgen structure</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">pass</span></div>

    <span class="nd">@property</span>
    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="nf">atoms</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Returns Atoms string from a structure that goes in feff.inp file.</span>

<span class="sd">        Returns:</span>
<span class="sd">            Atoms object.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">pass</span>

    <span class="nd">@property</span>
    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="nf">tags</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Returns standard calculation parameters.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span>

    <span class="nd">@property</span>
    <span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
    <span class="k">def</span> <span class="nf">potential</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Returns POTENTIAL section used in feff.inp from a structure.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">pass</span>

<div class="viewcode-block" id="AbstractFeffInputSet.all_input"><a class="viewcode-back" href="../../../../pymatgen.io.feff.sets.html#pymatgen.io.feff.sets.AbstractFeffInputSet.all_input">[docs]</a>    <span class="k">def</span> <span class="nf">all_input</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Returns all input files as a dict of {filename: feffio object}</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">d</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;HEADER&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">header</span><span class="p">(),</span> <span class="s2">&quot;PARAMETERS&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">tags</span><span class="p">}</span>

        <span class="k">if</span> <span class="s2">&quot;RECIPROCAL&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">tags</span><span class="p">:</span>
            <span class="n">d</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="s2">&quot;POTENTIALS&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">potential</span><span class="p">,</span> <span class="s2">&quot;ATOMS&quot;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">atoms</span><span class="p">})</span>

        <span class="k">return</span> <span class="n">d</span></div>

<div class="viewcode-block" id="AbstractFeffInputSet.write_input"><a class="viewcode-back" href="../../../../pymatgen.io.feff.sets.html#pymatgen.io.feff.sets.AbstractFeffInputSet.write_input">[docs]</a>    <span class="k">def</span> <span class="nf">write_input</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">output_dir</span><span class="o">=</span><span class="s2">&quot;.&quot;</span><span class="p">,</span> <span class="n">make_dir_if_not_present</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Writes a set of FEFF input to a directory.</span>

<span class="sd">        Args:</span>
<span class="sd">            output_dir: Directory to output the FEFF input files</span>
<span class="sd">            make_dir_if_not_present: Set to True if you want the directory (</span>
<span class="sd">                and the whole path) to be created if it is not present.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="n">make_dir_if_not_present</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">output_dir</span><span class="p">):</span>
            <span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="n">output_dir</span><span class="p">)</span>

        <span class="n">feff</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">all_input</span><span class="p">()</span>

        <span class="n">feff_input</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="se">\n\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">feff</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span>
                                 <span class="p">[</span><span class="s2">&quot;HEADER&quot;</span><span class="p">,</span> <span class="s2">&quot;PARAMETERS&quot;</span><span class="p">,</span> <span class="s2">&quot;POTENTIALS&quot;</span><span class="p">,</span> <span class="s2">&quot;ATOMS&quot;</span><span class="p">]</span>
                                 <span class="k">if</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">feff</span><span class="p">)</span>

        <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">feff</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
            <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">output_dir</span><span class="p">,</span> <span class="n">k</span><span class="p">),</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
                <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">v</span><span class="p">))</span>

        <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">output_dir</span><span class="p">,</span> <span class="s2">&quot;feff.inp&quot;</span><span class="p">),</span> <span class="s2">&quot;w&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
            <span class="n">f</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">feff_input</span><span class="p">)</span>

        <span class="c1"># write the structure to cif file</span>
        <span class="k">if</span> <span class="s2">&quot;ATOMS&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">feff</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">struct</span><span class="o">.</span><span class="n">to</span><span class="p">(</span><span class="n">fmt</span><span class="o">=</span><span class="s2">&quot;cif&quot;</span><span class="p">,</span>
                                 <span class="n">filename</span><span class="o">=</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span>
                                     <span class="n">output_dir</span><span class="p">,</span> <span class="n">feff</span><span class="p">[</span><span class="s2">&quot;PARAMETERS&quot;</span><span class="p">][</span><span class="s2">&quot;CIF&quot;</span><span class="p">]))</span></div></div>


<div class="viewcode-block" id="FEFFDictSet"><a class="viewcode-back" href="../../../../pymatgen.io.feff.sets.html#pymatgen.io.feff.sets.FEFFDictSet">[docs]</a><span class="k">class</span> <span class="nc">FEFFDictSet</span><span class="p">(</span><span class="n">AbstractFeffInputSet</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Standard implementation of FeffInputSet, which can be extended by specific</span>
<span class="sd">    implementations.</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">absorbing_atom</span><span class="p">,</span> <span class="n">structure</span><span class="p">,</span> <span class="n">radius</span><span class="p">,</span> <span class="n">config_dict</span><span class="p">,</span>
                 <span class="n">edge</span><span class="o">=</span><span class="s2">&quot;K&quot;</span><span class="p">,</span> <span class="n">spectrum</span><span class="o">=</span><span class="s2">&quot;EXAFS&quot;</span><span class="p">,</span> <span class="n">nkpts</span><span class="o">=</span><span class="mi">1000</span><span class="p">,</span>
                 <span class="n">user_tag_settings</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>

<span class="sd">        Args:</span>
<span class="sd">            absorbing_atom (str/int): absorbing atom symbol or site index</span>
<span class="sd">            structure (Structure): input structure</span>
<span class="sd">            radius (float): cluster radius</span>
<span class="sd">            config_dict (dict): control tag settings dict</span>
<span class="sd">            edge (str): absorption edge</span>
<span class="sd">            spectrum (str): type of spectrum to calculate, available options :</span>
<span class="sd">                EXAFS, XANES, DANES, XMCD, ELNES, EXELFS, FPRIME, NRIXS, XES.</span>
<span class="sd">                The default is EXAFS.</span>
<span class="sd">            nkpts (int): Total number of kpoints in the brillouin zone. Used</span>
<span class="sd">                only when feff is run in the reciprocal space mode.</span>
<span class="sd">            user_tag_settings (dict): override default tag settings. To delete</span>
<span class="sd">                tags, set the key &#39;_del&#39; in the user_tag_settings.</span>
<span class="sd">                eg: user_tag_settings={&quot;_del&quot;: [&quot;COREHOLE&quot;, &quot;EXCHANGE&quot;]}</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">absorbing_atom</span> <span class="o">=</span> <span class="n">absorbing_atom</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">structure</span> <span class="o">=</span> <span class="n">structure</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">radius</span> <span class="o">=</span> <span class="n">radius</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">config_dict</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">edge</span> <span class="o">=</span> <span class="n">edge</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">spectrum</span> <span class="o">=</span> <span class="n">spectrum</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">nkpts</span> <span class="o">=</span> <span class="n">nkpts</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">user_tag_settings</span> <span class="o">=</span> <span class="n">user_tag_settings</span> <span class="ow">or</span> <span class="p">{}</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="p">[</span><span class="s2">&quot;EDGE&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">edge</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">user_tag_settings</span><span class="p">)</span>
        <span class="k">if</span> <span class="s2">&quot;_del&quot;</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">user_tag_settings</span><span class="p">:</span>
            <span class="k">for</span> <span class="n">tag</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">user_tag_settings</span><span class="p">[</span><span class="s2">&quot;_del&quot;</span><span class="p">]:</span>
                <span class="k">if</span> <span class="n">tag</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="p">:</span>
                    <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="p">[</span><span class="n">tag</span><span class="p">]</span>
            <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="p">[</span><span class="s2">&quot;_del&quot;</span><span class="p">]</span>
        <span class="c1"># k-space feff only for small systems. The hardcoded system size in</span>
        <span class="c1"># feff is around 14 atoms.</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">small_system</span> <span class="o">=</span> <span class="kc">True</span> <span class="k">if</span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structure</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">14</span> <span class="ow">and</span> <span class="s1">&#39;EXAFS&#39;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="p">)</span> <span class="k">else</span> <span class="kc">False</span>

<div class="viewcode-block" id="FEFFDictSet.header"><a class="viewcode-back" href="../../../../pymatgen.io.feff.sets.html#pymatgen.io.feff.sets.FEFFDictSet.header">[docs]</a>    <span class="k">def</span> <span class="nf">header</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">source</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="n">comment</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Creates header string from structure object</span>

<span class="sd">        Args:</span>
<span class="sd">            source: Source identifier used to create structure, can be defined</span>
<span class="sd">                however user wants to organize structures, calculations, etc.</span>
<span class="sd">                example would be Materials Project material ID number.</span>
<span class="sd">            comment: comment to include in header</span>

<span class="sd">        Returns:</span>
<span class="sd">            Header</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="n">Header</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structure</span><span class="p">,</span> <span class="n">source</span><span class="p">,</span> <span class="n">comment</span><span class="p">)</span></div>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">tags</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        FEFF job parameters.</span>

<span class="sd">        Returns:</span>
<span class="sd">            Tags</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">if</span> <span class="s2">&quot;RECIPROCAL&quot;</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="p">:</span>
            <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">small_system</span><span class="p">:</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="p">[</span><span class="s2">&quot;CIF&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">{}</span><span class="s2">.cif&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">structure</span><span class="o">.</span><span class="n">formula</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">&quot; &quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">))</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="p">[</span><span class="s2">&quot;TARGET&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">atoms</span><span class="o">.</span><span class="n">center_index</span> <span class="o">+</span> <span class="mi">1</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="p">[</span><span class="s2">&quot;COREHOLE&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&quot;RPA&quot;</span>
                <span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">&quot;Setting COREHOLE = RPA for K-space calculation&quot;</span><span class="p">)</span>
                <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;KMESH&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">):</span>
                    <span class="n">abc</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">structure</span><span class="o">.</span><span class="n">lattice</span><span class="o">.</span><span class="n">abc</span>
                    <span class="n">mult</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">nkpts</span> <span class="o">*</span> <span class="n">abc</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">*</span> <span class="n">abc</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">*</span> <span class="n">abc</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span> <span class="o">**</span> <span class="p">(</span><span class="mi">1</span> <span class="o">/</span> <span class="mi">3</span><span class="p">)</span>
                    <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="p">[</span><span class="s2">&quot;KMESH&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="nb">int</span><span class="p">(</span><span class="nb">round</span><span class="p">(</span><span class="n">mult</span> <span class="o">/</span> <span class="n">l</span><span class="p">))</span> <span class="k">for</span> <span class="n">l</span> <span class="ow">in</span> <span class="n">abc</span><span class="p">]</span>
            <span class="k">else</span><span class="p">:</span>
                <span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span><span class="s2">&quot;Large system(&gt;=14 atoms) or EXAFS calculation, </span><span class="se">\</span>
<span class="s2">                                removing K-space settings&quot;</span><span class="p">)</span>
                <span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="p">[</span><span class="s2">&quot;RECIPROCAL&quot;</span><span class="p">]</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;CIF&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;TARGET&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;KMESH&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;STRFAC&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>

        <span class="k">return</span> <span class="n">Tags</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="p">)</span>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">potential</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        FEFF potential</span>

<span class="sd">        Returns:</span>
<span class="sd">            Potential</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="n">Potential</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structure</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">absorbing_atom</span><span class="p">)</span>

    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">atoms</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        absorber + the rest</span>

<span class="sd">        Returns:</span>
<span class="sd">            Atoms</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="k">return</span> <span class="n">Atoms</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">structure</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">absorbing_atom</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">radius</span><span class="p">)</span>

    <span class="k">def</span> <span class="fm">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="n">output</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">spectrum</span><span class="p">]</span>
        <span class="n">output</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span><span class="s2">&quot;</span><span class="si">%s</span><span class="s2"> = </span><span class="si">%s</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">v</span><span class="p">))</span>
                       <span class="k">for</span> <span class="n">k</span><span class="p">,</span> <span class="n">v</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">config_dict</span><span class="o">.</span><span class="n">items</span><span class="p">()])</span>
        <span class="n">output</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot;&quot;</span><span class="p">)</span>
        <span class="k">return</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">output</span><span class="p">)</span>

<div class="viewcode-block" id="FEFFDictSet.from_directory"><a class="viewcode-back" href="../../../../pymatgen.io.feff.sets.html#pymatgen.io.feff.sets.FEFFDictSet.from_directory">[docs]</a>    <span class="nd">@staticmethod</span>
    <span class="k">def</span> <span class="nf">from_directory</span><span class="p">(</span><span class="n">input_dir</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Read in a set of FEFF input files from a directory, which is</span>
<span class="sd">        useful when existing FEFF input needs some adjustment.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="n">sub_d</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="k">for</span> <span class="n">fname</span><span class="p">,</span> <span class="n">ftype</span> <span class="ow">in</span> <span class="p">[(</span><span class="s2">&quot;HEADER&quot;</span><span class="p">,</span> <span class="n">Header</span><span class="p">),</span> <span class="p">(</span><span class="s2">&quot;PARAMETERS&quot;</span><span class="p">,</span> <span class="n">Tags</span><span class="p">)]:</span>
            <span class="n">fullzpath</span> <span class="o">=</span> <span class="n">zpath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">input_dir</span><span class="p">,</span> <span class="n">fname</span><span class="p">))</span>
            <span class="n">sub_d</span><span class="p">[</span><span class="n">fname</span><span class="o">.</span><span class="n">lower</span><span class="p">()]</span> <span class="o">=</span> <span class="n">ftype</span><span class="o">.</span><span class="n">from_file</span><span class="p">(</span><span class="n">fullzpath</span><span class="p">)</span>

        <span class="c1"># Generation of FEFFDict set requires absorbing atom, need to search</span>
        <span class="c1"># the index of absorption atom in the structure according to the</span>
        <span class="c1"># distance matrix and shell species information contained in feff.inp</span>

        <span class="n">absorber_index</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="n">radius</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="n">feffinp</span> <span class="o">=</span> <span class="n">zpath</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">input_dir</span><span class="p">,</span> <span class="s1">&#39;feff.inp&#39;</span><span class="p">))</span>

        <span class="k">if</span> <span class="s2">&quot;RECIPROCAL&quot;</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">sub_d</span><span class="p">[</span><span class="s2">&quot;parameters&quot;</span><span class="p">]:</span>
            <span class="n">input_atoms</span> <span class="o">=</span> <span class="n">Atoms</span><span class="o">.</span><span class="n">cluster_from_file</span><span class="p">(</span><span class="n">feffinp</span><span class="p">)</span>
            <span class="n">shell_species</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">x</span><span class="o">.</span><span class="n">species_string</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">input_atoms</span><span class="p">])</span>

            <span class="c1"># First row of distance matrix represents the distance from the absorber to</span>
            <span class="c1"># the rest atoms</span>
            <span class="n">distance_matrix</span> <span class="o">=</span> <span class="n">input_atoms</span><span class="o">.</span><span class="n">distance_matrix</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="p">:]</span>

            <span class="c1"># Get radius value</span>
            <span class="kn">from</span> <span class="nn">math</span> <span class="kn">import</span> <span class="n">ceil</span>
            <span class="n">radius</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">ceil</span><span class="p">(</span><span class="n">input_atoms</span><span class="o">.</span><span class="n">get_distance</span><span class="p">(</span><span class="n">input_atoms</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">input_atoms</span><span class="p">[</span><span class="mi">0</span><span class="p">]),</span>
                                                       <span class="n">input_atoms</span><span class="o">.</span><span class="n">index</span><span class="p">(</span><span class="n">input_atoms</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]))))</span>

            <span class="k">for</span> <span class="n">site_index</span><span class="p">,</span> <span class="n">site</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">sub_d</span><span class="p">[</span><span class="s1">&#39;header&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">struct</span><span class="p">):</span>

                <span class="k">if</span> <span class="n">site</span><span class="o">.</span><span class="n">specie</span> <span class="o">==</span> <span class="n">input_atoms</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">specie</span><span class="p">:</span>
                    <span class="n">site_atoms</span> <span class="o">=</span> <span class="n">Atoms</span><span class="p">(</span><span class="n">sub_d</span><span class="p">[</span><span class="s1">&#39;header&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">struct</span><span class="p">,</span> <span class="n">absorbing_atom</span><span class="o">=</span><span class="n">site_index</span><span class="p">,</span>
                                       <span class="n">radius</span><span class="o">=</span><span class="n">radius</span><span class="p">)</span>
                    <span class="n">site_distance</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">site_atoms</span><span class="o">.</span><span class="n">get_lines</span><span class="p">())[:,</span> <span class="mi">5</span><span class="p">]</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">float64</span><span class="p">)</span>
                    <span class="n">site_shell_species</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">site_atoms</span><span class="o">.</span><span class="n">get_lines</span><span class="p">())[:,</span> <span class="mi">4</span><span class="p">]</span>
                    <span class="n">shell_overlap</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">shell_species</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">site_shell_species</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>

                    <span class="k">if</span> <span class="n">np</span><span class="o">.</span><span class="n">allclose</span><span class="p">(</span><span class="n">distance_matrix</span><span class="p">[:</span><span class="n">shell_overlap</span><span class="p">],</span> <span class="n">site_distance</span><span class="p">[:</span><span class="n">shell_overlap</span><span class="p">])</span> <span class="ow">and</span> \
                            <span class="n">np</span><span class="o">.</span><span class="n">all</span><span class="p">(</span><span class="n">site_shell_species</span><span class="p">[:</span><span class="n">shell_overlap</span><span class="p">]</span> <span class="o">==</span> <span class="n">shell_species</span><span class="p">[:</span><span class="n">shell_overlap</span><span class="p">]):</span>
                        <span class="n">absorber_index</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">site_index</span><span class="p">)</span>

        <span class="k">if</span> <span class="s2">&quot;RECIPROCAL&quot;</span> <span class="ow">in</span> <span class="n">sub_d</span><span class="p">[</span><span class="s2">&quot;parameters&quot;</span><span class="p">]:</span>
            <span class="n">absorber_index</span> <span class="o">=</span> <span class="n">sub_d</span><span class="p">[</span><span class="s2">&quot;parameters&quot;</span><span class="p">][</span><span class="s2">&quot;TARGET&quot;</span><span class="p">]</span>
            <span class="n">absorber_index</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">absorber_index</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> <span class="o">-</span> <span class="mi">1</span>

        <span class="c1"># Generate the input set</span>
        <span class="k">if</span> <span class="s1">&#39;XANES&#39;</span> <span class="ow">in</span> <span class="n">sub_d</span><span class="p">[</span><span class="s2">&quot;parameters&quot;</span><span class="p">]:</span>
            <span class="n">CONFIG</span> <span class="o">=</span> <span class="n">loadfn</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">MODULE_DIR</span><span class="p">,</span> <span class="s2">&quot;MPXANESSet.yaml&quot;</span><span class="p">))</span>
            <span class="k">if</span> <span class="n">radius</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
                <span class="n">radius</span> <span class="o">=</span> <span class="mi">10</span>
            <span class="k">return</span> <span class="n">FEFFDictSet</span><span class="p">(</span><span class="n">absorber_index</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">sub_d</span><span class="p">[</span><span class="s1">&#39;header&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">struct</span><span class="p">,</span> <span class="n">radius</span><span class="o">=</span><span class="n">radius</span><span class="p">,</span>
                               <span class="n">config_dict</span><span class="o">=</span><span class="n">CONFIG</span><span class="p">,</span> <span class="n">edge</span><span class="o">=</span><span class="n">sub_d</span><span class="p">[</span><span class="s2">&quot;parameters&quot;</span><span class="p">][</span><span class="s2">&quot;EDGE&quot;</span><span class="p">],</span>
                               <span class="n">nkpts</span><span class="o">=</span><span class="mi">1000</span><span class="p">,</span> <span class="n">user_tag_settings</span><span class="o">=</span><span class="n">sub_d</span><span class="p">[</span><span class="s2">&quot;parameters&quot;</span><span class="p">])</span></div></div>


<div class="viewcode-block" id="MPXANESSet"><a class="viewcode-back" href="../../../../pymatgen.io.feff.sets.html#pymatgen.io.feff.sets.MPXANESSet">[docs]</a><span class="k">class</span> <span class="nc">MPXANESSet</span><span class="p">(</span><span class="n">FEFFDictSet</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    FeffDictSet for XANES spectroscopy.</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="n">CONFIG</span> <span class="o">=</span> <span class="n">loadfn</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">MODULE_DIR</span><span class="p">,</span> <span class="s2">&quot;MPXANESSet.yaml&quot;</span><span class="p">))</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">absorbing_atom</span><span class="p">,</span> <span class="n">structure</span><span class="p">,</span> <span class="n">edge</span><span class="o">=</span><span class="s2">&quot;K&quot;</span><span class="p">,</span> <span class="n">radius</span><span class="o">=</span><span class="mf">10.</span><span class="p">,</span>
                 <span class="n">nkpts</span><span class="o">=</span><span class="mi">1000</span><span class="p">,</span> <span class="n">user_tag_settings</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Args:</span>
<span class="sd">            absorbing_atom (str/int): absorbing atom symbol or site index</span>
<span class="sd">            structure (Structure): input</span>
<span class="sd">            edge (str): absorption edge</span>
<span class="sd">            radius (float): cluster radius in Angstroms.</span>
<span class="sd">            nkpts (int): Total number of kpoints in the brillouin zone. Used</span>
<span class="sd">                only when feff is run in the reciprocal space mode.</span>
<span class="sd">            user_tag_settings (dict): override default tag settings</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">absorbing_atom</span><span class="p">,</span> <span class="n">structure</span><span class="p">,</span> <span class="n">radius</span><span class="p">,</span>
                         <span class="n">MPXANESSet</span><span class="o">.</span><span class="n">CONFIG</span><span class="p">,</span> <span class="n">edge</span><span class="o">=</span><span class="n">edge</span><span class="p">,</span>
                         <span class="n">spectrum</span><span class="o">=</span><span class="s2">&quot;XANES&quot;</span><span class="p">,</span> <span class="n">nkpts</span><span class="o">=</span><span class="n">nkpts</span><span class="p">,</span>
                         <span class="n">user_tag_settings</span><span class="o">=</span><span class="n">user_tag_settings</span><span class="p">)</span></div>


<div class="viewcode-block" id="MPEXAFSSet"><a class="viewcode-back" href="../../../../pymatgen.io.feff.sets.html#pymatgen.io.feff.sets.MPEXAFSSet">[docs]</a><span class="k">class</span> <span class="nc">MPEXAFSSet</span><span class="p">(</span><span class="n">FEFFDictSet</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    FeffDictSet for EXAFS spectroscopy.</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="n">CONFIG</span> <span class="o">=</span> <span class="n">loadfn</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">MODULE_DIR</span><span class="p">,</span> <span class="s2">&quot;MPEXAFSSet.yaml&quot;</span><span class="p">))</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">absorbing_atom</span><span class="p">,</span> <span class="n">structure</span><span class="p">,</span> <span class="n">edge</span><span class="o">=</span><span class="s2">&quot;K&quot;</span><span class="p">,</span> <span class="n">radius</span><span class="o">=</span><span class="mf">10.</span><span class="p">,</span>
                 <span class="n">nkpts</span><span class="o">=</span><span class="mi">1000</span><span class="p">,</span> <span class="n">user_tag_settings</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Args:</span>
<span class="sd">            absorbing_atom (str/int): absorbing atom symbol or site index</span>
<span class="sd">            structure (Structure): input structure</span>
<span class="sd">            edge (str): absorption edge</span>
<span class="sd">            radius (float): cluster radius in Angstroms.</span>
<span class="sd">            nkpts (int): Total number of kpoints in the brillouin zone. Used</span>
<span class="sd">                only when feff is run in the reciprocal space mode.</span>
<span class="sd">            user_tag_settings (dict): override default tag settings</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">absorbing_atom</span><span class="p">,</span> <span class="n">structure</span><span class="p">,</span> <span class="n">radius</span><span class="p">,</span>
                         <span class="n">MPEXAFSSet</span><span class="o">.</span><span class="n">CONFIG</span><span class="p">,</span> <span class="n">edge</span><span class="o">=</span><span class="n">edge</span><span class="p">,</span>
                         <span class="n">spectrum</span><span class="o">=</span><span class="s2">&quot;EXAFS&quot;</span><span class="p">,</span> <span class="n">nkpts</span><span class="o">=</span><span class="n">nkpts</span><span class="p">,</span>
                         <span class="n">user_tag_settings</span><span class="o">=</span><span class="n">user_tag_settings</span><span class="p">)</span></div>


<div class="viewcode-block" id="MPEELSDictSet"><a class="viewcode-back" href="../../../../pymatgen.io.feff.sets.html#pymatgen.io.feff.sets.MPEELSDictSet">[docs]</a><span class="k">class</span> <span class="nc">MPEELSDictSet</span><span class="p">(</span><span class="n">FEFFDictSet</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    FeffDictSet for ELNES spectroscopy.</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">absorbing_atom</span><span class="p">,</span> <span class="n">structure</span><span class="p">,</span> <span class="n">edge</span><span class="p">,</span> <span class="n">spectrum</span><span class="p">,</span> <span class="n">radius</span><span class="p">,</span>
                 <span class="n">beam_energy</span><span class="p">,</span> <span class="n">beam_direction</span><span class="p">,</span> <span class="n">collection_angle</span><span class="p">,</span>
                 <span class="n">convergence_angle</span><span class="p">,</span> <span class="n">config_dict</span><span class="p">,</span> <span class="n">user_eels_settings</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">nkpts</span><span class="o">=</span><span class="mi">1000</span><span class="p">,</span> <span class="n">user_tag_settings</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Args:</span>
<span class="sd">            absorbing_atom (str/int): absorbing atom symbol or site index</span>
<span class="sd">            structure (Structure): input structure</span>
<span class="sd">            edge (str): absorption edge</span>
<span class="sd">            spectrum (str): ELNES or EXELFS</span>
<span class="sd">            radius (float): cluster radius in Angstroms.</span>
<span class="sd">            beam_energy (float): Incident beam energy in keV</span>
<span class="sd">            beam_direction (list): Incident beam direction. If None, the</span>
<span class="sd">                cross section will be averaged.</span>
<span class="sd">            collection_angle (float): Detector collection angle in mrad.</span>
<span class="sd">            convergence_angle (float): Beam convergence angle in mrad.</span>
<span class="sd">            user_eels_settings (dict): override default EELS config.</span>
<span class="sd">                See MPELNESSet.yaml for supported keys.</span>
<span class="sd">            nkpts (int): Total number of kpoints in the brillouin zone. Used</span>
<span class="sd">                only when feff is run in the reciprocal space mode.</span>
<span class="sd">            user_tag_settings (dict): override default tag settings</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">beam_energy</span> <span class="o">=</span> <span class="n">beam_energy</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">beam_direction</span> <span class="o">=</span> <span class="n">beam_direction</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">collection_angle</span> <span class="o">=</span> <span class="n">collection_angle</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">convergence_angle</span> <span class="o">=</span> <span class="n">convergence_angle</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">user_eels_settings</span> <span class="o">=</span> <span class="n">user_eels_settings</span>
        <span class="n">eels_config_dict</span> <span class="o">=</span> <span class="n">deepcopy</span><span class="p">(</span><span class="n">config_dict</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">beam_direction</span><span class="p">:</span>
            <span class="n">beam_energy_list</span> <span class="o">=</span> <span class="p">[</span><span class="n">beam_energy</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span>
            <span class="n">eels_config_dict</span><span class="p">[</span><span class="n">spectrum</span><span class="p">][</span><span class="s2">&quot;BEAM_DIRECTION&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">beam_direction</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="n">beam_energy_list</span> <span class="o">=</span> <span class="p">[</span><span class="n">beam_energy</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span>
            <span class="k">del</span> <span class="n">eels_config_dict</span><span class="p">[</span><span class="n">spectrum</span><span class="p">][</span><span class="s2">&quot;BEAM_DIRECTION&quot;</span><span class="p">]</span>
        <span class="n">eels_config_dict</span><span class="p">[</span><span class="n">spectrum</span><span class="p">][</span><span class="s2">&quot;BEAM_ENERGY&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">beam_energy_list</span>
        <span class="n">eels_config_dict</span><span class="p">[</span><span class="n">spectrum</span><span class="p">][</span><span class="s2">&quot;ANGLES&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="n">collection_angle</span><span class="p">,</span>
                                                <span class="n">convergence_angle</span><span class="p">]</span>

        <span class="k">if</span> <span class="n">user_eels_settings</span><span class="p">:</span>
            <span class="n">eels_config_dict</span><span class="p">[</span><span class="n">spectrum</span><span class="p">]</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">user_eels_settings</span><span class="p">)</span>

        <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">absorbing_atom</span><span class="p">,</span> <span class="n">structure</span><span class="p">,</span> <span class="n">radius</span><span class="p">,</span>
                         <span class="n">eels_config_dict</span><span class="p">,</span> <span class="n">edge</span><span class="o">=</span><span class="n">edge</span><span class="p">,</span>
                         <span class="n">spectrum</span><span class="o">=</span><span class="n">spectrum</span><span class="p">,</span> <span class="n">nkpts</span><span class="o">=</span><span class="n">nkpts</span><span class="p">,</span>
                         <span class="n">user_tag_settings</span><span class="o">=</span><span class="n">user_tag_settings</span><span class="p">)</span></div>


<div class="viewcode-block" id="MPELNESSet"><a class="viewcode-back" href="../../../../pymatgen.io.feff.sets.html#pymatgen.io.feff.sets.MPELNESSet">[docs]</a><span class="k">class</span> <span class="nc">MPELNESSet</span><span class="p">(</span><span class="n">MPEELSDictSet</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    FeffDictSet for ELNES spectroscopy.</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="n">CONFIG</span> <span class="o">=</span> <span class="n">loadfn</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">MODULE_DIR</span><span class="p">,</span> <span class="s2">&quot;MPELNESSet.yaml&quot;</span><span class="p">))</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">absorbing_atom</span><span class="p">,</span> <span class="n">structure</span><span class="p">,</span> <span class="n">edge</span><span class="o">=</span><span class="s2">&quot;K&quot;</span><span class="p">,</span> <span class="n">radius</span><span class="o">=</span><span class="mf">10.</span><span class="p">,</span>
                 <span class="n">beam_energy</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">beam_direction</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">collection_angle</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
                 <span class="n">convergence_angle</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">user_eels_settings</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">nkpts</span><span class="o">=</span><span class="mi">1000</span><span class="p">,</span>
                 <span class="n">user_tag_settings</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Args:</span>
<span class="sd">            absorbing_atom (str/int): absorbing atom symbol or site index</span>
<span class="sd">            structure (Structure): input structure</span>
<span class="sd">            edge (str): absorption edge</span>
<span class="sd">            radius (float): cluster radius in Angstroms.</span>
<span class="sd">            beam_energy (float): Incident beam energy in keV</span>
<span class="sd">            beam_direction (list): Incident beam direction. If None, the</span>
<span class="sd">                cross section will be averaged.</span>
<span class="sd">            collection_angle (float): Detector collection angle in mrad.</span>
<span class="sd">            convergence_angle (float): Beam convergence angle in mrad.</span>
<span class="sd">            user_eels_settings (dict): override default EELS config.</span>
<span class="sd">                See MPELNESSet.yaml for supported keys.</span>
<span class="sd">            nkpts (int): Total number of kpoints in the brillouin zone. Used</span>
<span class="sd">                only when feff is run in the reciprocal space mode.</span>
<span class="sd">            user_tag_settings (dict): override default tag settings</span>
<span class="sd">        &quot;&quot;&quot;</span>

        <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">absorbing_atom</span><span class="p">,</span> <span class="n">structure</span><span class="p">,</span> <span class="n">edge</span><span class="p">,</span>
                         <span class="s2">&quot;ELNES&quot;</span><span class="p">,</span> <span class="n">radius</span><span class="p">,</span> <span class="n">beam_energy</span><span class="p">,</span>
                         <span class="n">beam_direction</span><span class="p">,</span> <span class="n">collection_angle</span><span class="p">,</span>
                         <span class="n">convergence_angle</span><span class="p">,</span> <span class="n">MPELNESSet</span><span class="o">.</span><span class="n">CONFIG</span><span class="p">,</span>
                         <span class="n">user_eels_settings</span><span class="o">=</span><span class="n">user_eels_settings</span><span class="p">,</span>
                         <span class="n">nkpts</span><span class="o">=</span><span class="n">nkpts</span><span class="p">,</span> <span class="n">user_tag_settings</span><span class="o">=</span><span class="n">user_tag_settings</span><span class="p">)</span></div>


<div class="viewcode-block" id="MPEXELFSSet"><a class="viewcode-back" href="../../../../pymatgen.io.feff.sets.html#pymatgen.io.feff.sets.MPEXELFSSet">[docs]</a><span class="k">class</span> <span class="nc">MPEXELFSSet</span><span class="p">(</span><span class="n">MPEELSDictSet</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    FeffDictSet for EXELFS spectroscopy.</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="n">CONFIG</span> <span class="o">=</span> <span class="n">loadfn</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">MODULE_DIR</span><span class="p">,</span> <span class="s2">&quot;MPEXELFSSet.yaml&quot;</span><span class="p">))</span>

    <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">absorbing_atom</span><span class="p">,</span> <span class="n">structure</span><span class="p">,</span> <span class="n">edge</span><span class="o">=</span><span class="s2">&quot;K&quot;</span><span class="p">,</span> <span class="n">radius</span><span class="o">=</span><span class="mf">10.</span><span class="p">,</span>
                 <span class="n">beam_energy</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">beam_direction</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">collection_angle</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
                 <span class="n">convergence_angle</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">user_eels_settings</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">nkpts</span><span class="o">=</span><span class="mi">1000</span><span class="p">,</span>
                 <span class="n">user_tag_settings</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Args:</span>
<span class="sd">            absorbing_atom (str/int): absorbing atom symbol or site index</span>
<span class="sd">            structure (Structure): input structure</span>
<span class="sd">            edge (str): absorption edge</span>
<span class="sd">            radius (float): cluster radius in Angstroms.</span>
<span class="sd">            beam_energy (float): Incident beam energy in keV</span>
<span class="sd">            beam_direction (list): Incident beam direction. If None, the</span>
<span class="sd">                cross section will be averaged.</span>
<span class="sd">            collection_angle (float): Detector collection angle in mrad.</span>
<span class="sd">            convergence_angle (float): Beam convergence angle in mrad.</span>
<span class="sd">            user_eels_settings (dict): override default EELS config.</span>
<span class="sd">                See MPEXELFSSet.yaml for supported keys.</span>
<span class="sd">            nkpts (int): Total number of kpoints in the brillouin zone. Used</span>
<span class="sd">                only when feff is run in the reciprocal space mode.</span>
<span class="sd">            user_tag_settings (dict): override default tag settings</span>
<span class="sd">        &quot;&quot;&quot;</span>

        <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">absorbing_atom</span><span class="p">,</span> <span class="n">structure</span><span class="p">,</span> <span class="n">edge</span><span class="p">,</span>
                         <span class="s2">&quot;EXELFS&quot;</span><span class="p">,</span> <span class="n">radius</span><span class="p">,</span> <span class="n">beam_energy</span><span class="p">,</span>
                         <span class="n">beam_direction</span><span class="p">,</span> <span class="n">collection_angle</span><span class="p">,</span>
                         <span class="n">convergence_angle</span><span class="p">,</span> <span class="n">MPEXELFSSet</span><span class="o">.</span><span class="n">CONFIG</span><span class="p">,</span>
                         <span class="n">user_eels_settings</span><span class="o">=</span><span class="n">user_eels_settings</span><span class="p">,</span>
                         <span class="n">nkpts</span><span class="o">=</span><span class="n">nkpts</span><span class="p">,</span> <span class="n">user_tag_settings</span><span class="o">=</span><span class="n">user_tag_settings</span><span class="p">)</span></div>
</pre></div>

            <div class="clearer"></div>
          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../../../index.html">pymatgen 2020.7.3 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../../../pymatgen.html" >pymatgen</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">pymatgen.io.feff.sets</a></li> 
      </ul>
    </div>

    <div class="footer" role="contentinfo">
        &#169; Copyright 2011, Pymatgen Development Team.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.1.2.
    </div>
<div class="footer">This page uses <a href="http://analytics.google.com/">
Google Analytics</a> to collect statistics. You can disable it by blocking
the JavaScript coming from www.google-analytics.com.
<script type="text/javascript">
  (function() {
    var ga = document.createElement('script');
    ga.src = ('https:' == document.location.protocol ?
              'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    ga.setAttribute('async', 'true');
    document.documentElement.firstChild.appendChild(ga);
  })();
</script>
</div>

  </body>
</html>